package com.sansi.bleFloodlight.adapter;

import android.content.Context;
import android.view.View;

import com.chad.library.adapter.base.BaseViewHolder;
import com.github.iielse.switchbutton.SwitchView;
import com.sansi.bleFloodlight.R;
import com.sansi.bleFloodlight.model.TimeModel;

public class TimeNotNULLAdapter {

    public static final int TIMENOTNULLLAYOUT = R.layout.layout_item_time_not_null;

    public TimeNotNULLAdapter(final BaseViewHolder helper, TimeModel timeModel, final Context context) {
        SwitchView switchView = helper.getView(R.id.time_switch);
        switchView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                boolean isOpened = ((SwitchView) view).isOpened();
                if (isOpened) {
                    helper.setTextColor(R.id.tv_name, context.getResources().getColor(R.color.color_white_15));
                    helper.setTextColor(R.id.tv_time, context.getResources().getColor(R.color.color_white_15));
                } else {
                    helper.setTextColor(R.id.tv_name, context.getResources().getColor(R.color.color_white_50));
                    helper.setTextColor(R.id.tv_time, context.getResources().getColor(R.color.color_white_50));
                }
            }
        });
    }
}
